﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EBookStore.Users;
using EBookStore.Books;
using EBookStore.Orders;
using EBookStore.Payments;

namespace EBookStore.Publishers
{
    /// <summary>
    /// Singleton class
    /// </summary>
    public class Publisher
    {
        #region private members

            private readonly string _id;
            private TimeSpan _shippingTime;
            
        #endregion

        public string Name { get; set; }
        public string Adress { get; set; }
        public string ID { get { return _id; } }
        public string FaxNumber { get; set; }
        public TimeSpan TypicalShippingTime { get { return _shippingTime; } }
        public int OrderedBooks { get; set; }
        public int SuppliedBooks { get; set; }

        
        
        public Publisher(string name, string adress, string faxNumber, TimeSpan shippingTime)
        {
            this._id  = Utils.IDGenerator.CreateUniqeID();
            this.Name = name;
            this.Adress = adress;
            this._shippingTime = shippingTime;
            this.FaxNumber = faxNumber;
            ValidateData();
        }

        /// <summary>
        /// Validate data
        /// </summary>
        private void ValidateData()
        {
            if (String.IsNullOrEmpty(this.Name) || String.IsNullOrEmpty(this.Adress)
                || String.IsNullOrEmpty(this.FaxNumber))
            {
                throw new Exception("Illegal parameter sent to Constructor");
            }
        }


        #region Public Functions

        #endregion

        #region Private

        #endregion
    }
}
